package com.mspbots.core.wise.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mspbots.core.AbstractBaseController;
import com.mspbots.core.wise.model.TenantReport;
import com.mspbots.core.wise.service.TenantReportService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.concurrent.Callable;

/**
 * com.mspbots.core.controller.TenantReportController
 *
 * @author Alex bob(https://github.com/vnobo)
 * @date Created by 2019/7/16
 */
@RestController
@RequestMapping(path = "report")
public class TenantReportController extends AbstractBaseController<TenantReport, TenantReportService> {

    @Override
    public Callable selectPage(Page<TenantReport> page, TenantReport queryParams) {
        QueryWrapper<TenantReport> queryWrapper = new QueryWrapper<>(queryParams);
        return () -> service.page(page, queryWrapper);
    }

    @PostMapping("/insertAndSendMail")
    public Callable insertAndSendMail(@RequestBody TenantReport params) {

        return () -> this.service.senderMail(params);
    }

}
